/* eslint-disable import/first */
import Taro from "@tarojs/taro";
import { useState } from "react";
import { View, Image } from "@tarojs/components";
// import { AtActionSheet, AtActionSheetItem } from "taro-ui";
import { ActionSheet } from "@antmjs/vantui";
// import test from '../../static/circle.png'
import { copyrightType } from "../../util/copyright-type";
import "./copyright.scss";
import "@antmjs/vantui/es/action-sheet/style";

const Copyright = () => {
  const [isOpened, setOpen] = useState<boolean>(false);
  const [actions] = useState([
    {
      name: "我是著作权人"
    },
    {
      name: "我是代理人"
    }
  ]);
  // const [items, setItems] = useState([
  //   { title: "选择作品", desc: "这里是额外的信息，最多两行" },
  //   { title: "步骤二", desc: "这里是额外的信息，最多两行" },
  //   { title: "步骤三", desc: "这里是额外的信息，最多两行" }
  // ]);
  // const [current, setCurrent] = useState(0);
  // const onChange = res => {
  //   setCurrent(current);
  // };

  const goSubmit = () => {
    // setState({ show: !state.show });
    setOpen(!isOpened);
  };

  const submit = (value: any) => {
    // 1.著作权人  2.代理人
    if (value.detail.name === "我是著作权人") {
      Taro.navigateTo({
        url: "/pages/copyright/copyright-submit/copyright-submit?userType=" + 1
      });
    } else if (value.detail.name === "我是代理人") {
      Taro.navigateTo({
        url: "/pages/copyright/copyright-sub/copyright-sub?userType=" + 2
      });
    }
  };

  return (
    <View className='index'>
      {/* <View className='at-article'>可登记作品类型</View> */}
      {/* <View className='top'>
        {copyrightType.map(item => {
          return (
            // eslint-disable-next-line react/jsx-key
            <View className='top-item'>
              <Image
                style={{ marginBottom: "10px" }}
                className='img-style'
                src={item.img}
              />
              <View>{item.name}</View>
            </View>
          );
        })}
      </View> */}
      <View className='center'>
        <View className='btn' onClick={goSubmit}>
          在线登记
        </View>
      </View>
      <ActionSheet
        show={isOpened}
        actions={actions}
        // onClose={goSubmit}
        onClose={goSubmit}
        onSelect={submit}
      />
    </View>
  );
};

export default Copyright;
